#include <iostream>
#include <thread>
#include <string>

using namespace std;

void download(string file) {
    for (int i = 0; i < 10; ++i) {
        cout << "Downloading" << file
            << "(" << i * 10 << "%)..." << endl;
        //让当前线程休眠一段时间
        this_thread::sleep_for(chrono::milliseconds(400));
    }
    cout << "Download complete:" << file << endl;
}

void interact() {
    cout << "请输入：" << endl; 
    string name;
    cin >> name;
    cout << "Hi," << name << endl;
}

int main() {
    //通过thread指定一个线程
    //会在t1线程里调用download函数
    thread t1([&] {  
        download("hello.zip");
        });

    interact();
    t1.join();
    return 0;
}

/*

*/